<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>任务管理-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<link rel="stylesheet" href="__PUBLIC__/mobile/css/mobiscroll.min.css">
</head>
<body style="background: #f3f3f3;">
<div class="header">
    <a class="back_btn" href="javascript:history.back(-1);"></a>
	编辑人员安排
</div>
<div class="content">
    <div class="communicate_add">
		<form name='number_validate'>
			<div class="form_item">
				<div class="form_item_tit">
					任务信息
				</div>
				<div class="form_item_box">
					<ul class="choice_list">
						<li class="name_li">
							<input id="name" class="text_input" name="uids" type="text" mid="{$detail['uid']}" value="{$detail['name']}" readonly placeholder="请点击选择人员…">
						</li>
						<li class="data_li">
							<input id="end_date" class="text_input" name="end_date" type="text" value="{$detail['end_date']}" readonly placeholder="请选择任务截止日期…">
						</li>
					</ul>
				</div>
				<div class="form_item_tit">
					任务说明
				</div>
				<div class="form_item_box label_box">
					<textarea name="note" placeholder="点击填写任务说明…">{$detail['note']}</textarea>
				</div>
				<input type="hidden" name="id" value="{$mid}">
				<div class="build_btn paddbox"><div><button type="button" class="sub_btn main_sub">提 交</button></div></div>
			</div>
		</form>
    </div>
</div>
<include file="Include:javascript" />
<script src="__PUBLIC__/mobile/js/mobiscroll.min.js"></script>
<script>
	var provinces = {$user_list};
    $(function(){
        $("#project_fix .back_btn").on("click", function(e) {
			$("#project_fix,#project_fix .search_inp span").fadeOut();
			$('html,#project_fix .search_cont').removeClass('active');
			$('#project_fix .search_inp input').val('');
			$('#project_fix .search_result,#project_fix .search_li').hide();
		});

		$("#name").CityPicker();
		$("[name='end_date'],[name='uids']").change(function(){
            submit();
        })
        $("[name='note']").blur(function(){
            submit();
        })
        //日历
        var ss = "{$result['start_date']}",
            rr = ss.replace(/-/g,","),
            aa = "{$result['end_date']}",
            ff = aa.replace(/-/g,","),
            min = new Date(ss),
            max = new Date(aa);
        
        $('#end_date').mobiscroll().date({
            theme: 'ios',
            lang: 'zh',
            max: max,
            min: min,
            display: 'bottom'
        });
		submit();
		//提交
		$('.main_sub').click(function(){
            var uid = $("[name='uids']").attr('mid');

            $.ajax({
                type:"POST",
                async:false,
                dataType:"json",
                data:$("[name='number_validate']").serialize()+"&action=edit_user"+"&uid="+uid+"&pid={$ppid}",
                url:"__APP__/Mobile/Project/task_ajax",
                success:function(data){
                    success_pop(data.status,data.msg,1,"__APP__/Mobile/Project/task_detail/id/{$id}/pid/{$pid}");
                }
            });
        })
    })
    //提交
    function submit(){
		var tag = true;
		$('.text_input').each(function(){
			if($(this).val()==''){
				tag = false;
				$('.sub_btn').addClass('disabled').attr('disabled',true);
			}
		})
        if($("[name='note']").val()==''){
            tag = false;
            $('.sub_btn').addClass('disabled').attr('disabled',true);
        }
        if(tag){
            $('.sub_btn').removeClass('disabled').attr('disabled',false);
        }
    }
    function bg_che(){
        $('.bg_li p').hide();
		var val_arr=$("[name='uids']").val().split('【');
		var	val=val_arr[0],
            mid = $("[name='uids']").attr('mid');
        $('.bg_li').addClass('active').find('.span').append("<span><a href='javascript:;'></a><input type='text' readonly value='"+val+"''><input name='hide_val[]' type='hidden' value='"+mid+"'></span>");
    }
    function remove(){
        $('.picker_tit').html('<a class="back_btn" href="javascript:;"></a>选择人员')
    }
</script>
<script src="__PUBLIC__/mobile/js/cityPicker.js"></script>
</body>
</html>